<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
  
    <link rel="stylesheet" type="text/css" href="/Public/admin/Css/bootstrap.min.css" />
     <link rel="stylesheet" type="text/css" href="/Public/admin/Css/ui.css" />
      <link rel="stylesheet" type="text/css" href="/Public/admin/Css/Admin-default.css" />
   
</head>
<body>
<div class="page-content-wrap">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="panel panel-default">
                                <div class="panel-body">
<form id="questions-index-form" action="<?php echo U('Questions/delete');?>" method="post">

    <input type="hidden" name="questionnaire_id" value="<?php echo ($questionnaire["id"]); ?>">
    <input type="hidden" id="questionnaire_type" value="<?php echo ($questionnaire["type"]); ?>">

    <div class="questionnaire-info">
    	<div  class="questionnaire-title">
            <?php switch($questionnaire["type"]): case "survey": ?><span class="label label-danger"><i class="fa fa-tag"></i>调研卷</span><?php break;?>
                <?php case "exam": ?><span class="label label-warning"><i class="fa fa-tag"></i>考试卷</span><?php break; endswitch;?> 

    		<h2><?php echo ($questionnaire["name"]); ?></h2>
    	</div>

    	<blockquote>
    	    <p><?php echo ($questionnaire["description"]); ?></p>
    	</blockquote>

        <a href="<?php echo U('Signimage/index', array('questionnaire_id' => $questionnaire['id']));?>">
            <div class="widget widget-warning widget-item-icon">
                <div class="widget-item-right">
                    <span class="fa fa-image"></span>
                </div>
                <div class="widget-data-left">
                    <div class="widget-int num-count"><?php echo ($questionnaire["signimageNum"]); ?></div>
                    <div class="widget-title" style="font-family: '华文行楷'">已上传</div>
                    <div class="widget-subtitle" style="position: absolute;bottom: 0;font-family: '华文新魏'">管理问卷签名图</div>
                </div>
            </div>
        </a>

    </div>

    <div class="table-tools">
        <a href="<?php echo U('Questions/add', array('questionnaire_id' => $questionnaire['id']));?>" class="btn btn-info" title="添加新的问题"><i class="fa fa-copy"></i> 添 加 </a>
        <button type="submit" class="btn btn-primary" title="删除勾选的问题"><i class="glyphicon glyphicon-remove"></i> 删 除 </button>
        <button type="button" class="btn btn-success" title="重新排序问题" onclick="sortQuestions()"><i class="fa fa-copy"></i> 重 排 </button>
        <p>问题列表</p>
    </div>

    <table id="questions-table" class="table table-striped table-hover table-condensed datatable">
        <thead>
            <tr>
                <th width="50px"> </th>
                <th>问题</th>
                <th width="150px">操作</th>
                <th width="80px">排序</th>
            </tr>
        </thead>
        <tbody>
        	<?php if(is_array($questions)): $i = 0; $__LIST__ = $questions;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$question): $mod = ($i % 2 );++$i;?><tr>
        			<td width="50px"><input name='id[]' type="checkbox" value="<?php echo ($question["id"]); ?>" /></td>
        			<td class="question-name"><?php echo ($question["name"]); ?></td>
        			<td width="150px">
                        <a href="<?php echo U('Questions/edit', array('id' => $question['id'], 'questionnaire_id' => $questionnaire['id']));?>" class="btn btn-default btn-rounded btn-condensed btn-sm" title="编辑问题"><span class="fa fa-pencil"></span>
                        </a>
                        <a href="<?php echo U('Questions/delete', array('id' => $question['id'], 'questionnaire_id' => $questionnaire['id']));?>" class="btn btn-danger btn-rounded btn-condensed btn-sm" title="删除问题"><span class="fa fa-times"></span></a>
        			</td>
        			<td width="80px"><input name="sort[<?php echo ($question["id"]); ?>]" class="sort-input" type="text" value="<?php echo ($question["sort"]); ?>" /></td>
        		</tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>